package behaviours;

public class Behaviour {

	protected int sleep = 250;
	
		
	protected boolean isFinished(){
		return true;
	}
	
	protected void begin() throws InterruptedException{}
	
	protected void loop() throws InterruptedException{};
	
	protected void end() throws InterruptedException{}
	
	public final void execute() throws InterruptedException{
		begin();
		while(!isFinished()){
			loop();
			Thread.sleep(sleep);
		}
		end();
	}
	
	public final void execute(Object... arguments) throws InterruptedException{
		if(handleArguments(arguments))
			execute();
	}
	
	protected boolean handleArguments(Object[] arguments){return true;}
	
}
